﻿using System;
using System.Linq;
using System.Collections.Generic;
using System.Text;

namespace MileageTracker
{
    public class Mileage
    {
        public decimal Distance { get; set; }

        public decimal Fuel { get; set; }

        public decimal Price { get; set; }

        public decimal Tank { get; set; }

        public decimal MilesPerGallon { get; set; }

        public decimal GallonsPer100Miles { get; set; }

        public decimal CostPer100Miles { get; set; }

        public decimal MaximumRange { get; set; }

        public void Calculate()
        {
            MilesPerGallon = 0;
            GallonsPer100Miles = 0;

            if(Fuel != 0)
                MilesPerGallon = Distance/Fuel;

            if (MilesPerGallon != 0)
                GallonsPer100Miles = 100/MilesPerGallon;

            CostPer100Miles = GallonsPer100Miles*Price;

            MaximumRange = Tank*MilesPerGallon;
        }
    }
}
